from django.http import HttpRequest
from django.shortcuts import render

from notebook.models import Notebook


def index(request: HttpRequest):
    # latest 方法用于获取最新的记录，由于 Notebook 的 Meta 没定义 get_latest_by 所以这里我们手动指定
    latest_notebook = Notebook.objects.latest('updated_time')
    return render(request, "index.html", {'latest_notebook': latest_notebook})


def about(request: HttpRequest):
    return render(request, "about.html")
